Skip to content

Add store-auth source and auto fallback to store list#7714

Draft
dmerand wants to merge 2 commits into
donald/store-list-local-auth-seamfrom
donald/store-list-local-fallback
Draft

Add store-auth source and auto fallback to store list#7714
dmerand wants to merge 2 commits into
donald/store-list-local-auth-seamfrom
donald/store-list-local-fallback

Conversation

@dmerand
Copy link
Copy Markdown
Contributor

@dmerand dmerand commented Jun 4, 2026

Summary

Add the --from source selector and auto fallback to shopify store list on top of #7709.

Demo:

Screen Recording 2026-06-05 at 11.08.13 AM.mov (uploaded via Graphite)

Scope

  • add --from auto | organization | store-auth (default auto)
  • add store-auth source, backed by listStoredStoreAuthSummaries(), rendered as Subdomain | Connected; its JSON carries only store + connectedAt (no user id / email)
  • make auto prefer your Shopify organization and fall back to locally stored store auth whenever the organization can't be listed for the current CLI session (not signed in, session not resolvable, reauthentication required, or any auth/network/listing error)
  • keep --from organization strict: no fallback, original error surfaced
  • thread noPrompt through ensureAuthenticatedBusinessPlatform() so auto can probe without prompting
  • carry --organization-id through auto/organization; reject it with --from store-auth; an unknown org id is a hard error in every mode (no silent fallback)
  • extend the 250 cap + truncation warning to the store-auth source; sort store-auth newest-first by connected date

Contract

  • result discriminant is organization | store-auth; no "Business Platform" wording in the command contract or output
  • every organization-listing failure is classified unavailable (original error preserved) so auto always falls back while --from organization rethrows

Smoke checks

  • logged out, store list → falls back to store-auth, exits 0
  • store list --from store-auth → local store auth table, exits 0
  • store list --from organization → strict, surfaces the failure

@github-actions github-actions Bot added the no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users. label Jun 4, 2026
@dmerand dmerand force-pushed the donald/store-list-local-auth-seam branch from 89f393a to 619636c Compare June 5, 2026 13:41
@dmerand dmerand force-pushed the donald/store-list-local-fallback branch from 1e3e4bc to 770846a Compare June 5, 2026 13:41
@dmerand dmerand force-pushed the donald/store-list-local-auth-seam branch from 619636c to 7c049c1 Compare June 5, 2026 14:10
@dmerand dmerand force-pushed the donald/store-list-local-fallback branch from 770846a to 95d8a71 Compare June 5, 2026 14:10
@dmerand dmerand force-pushed the donald/store-list-local-auth-seam branch from 7c049c1 to 52daf1c Compare June 5, 2026 14:24
@dmerand dmerand force-pushed the donald/store-list-local-fallback branch from 95d8a71 to 04f35fd Compare June 5, 2026 14:24
@dmerand dmerand changed the title Add local source and auto fallback to store list Add store-auth source and auto fallback to store list Jun 5, 2026
Copy link
Copy Markdown
Contributor Author

dmerand commented Jun 5, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link
Copy Markdown
Contributor

/snapit

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 5, 2026

🫰✨ Thanks @nickwesselman! Your snapshot has been published to npm.

Test the snapshot by installing your package globally:

pnpm i -g --@shopify:registry=https://registry.npmjs.org @shopify/cli@0.0.0-snapshot-20260605172558

Caution

After installing, validate the version by running shopify version in your terminal.
If the versions don't match, you might have multiple global instances installed.
Use which shopify to find out which one you are running and uninstall it.

@dmerand dmerand force-pushed the donald/store-list-local-fallback branch from 04f35fd to 065f5fa Compare June 5, 2026 18:12
@dmerand dmerand force-pushed the donald/store-list-local-auth-seam branch 2 times, most recently from 00dce2a to 22e4f4a Compare June 5, 2026 18:31
@dmerand dmerand force-pushed the donald/store-list-local-fallback branch 3 times, most recently from 10fb6d5 to c8eed6e Compare June 5, 2026 18:52
@dmerand dmerand force-pushed the donald/store-list-local-fallback branch from c8eed6e to aa58407 Compare June 5, 2026 19:06
@dmerand dmerand force-pushed the donald/store-list-local-auth-seam branch from 22e4f4a to 31a07f1 Compare June 5, 2026 19:06
Only failures from authenticating and listing organizations are classified as
'unavailable' (so --from auto can fall back). In-process errors now propagate
instead of masquerading as an unavailable service. The all-organizations-failed
case returns 'unavailable' explicitly rather than throwing into a broad catch.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 5, 2026

Differences in type declarations

We detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:

  • Some seemingly private modules might be re-exported through public modules.
  • If the branch is behind main you might see odd diffs, rebase main into this branch.

New type declarations

We found no new type declarations in this PR

Existing type declarations

packages/cli-kit/dist/public/node/session.d.ts
@@ -119,9 +119,10 @@ export declare function ensureAuthenticatedThemes(store: string, password: strin
  * Ensure that we have a valid session to access the Business Platform API.
  *
  * @param scopes - Optional array of extra scopes to authenticate with.
+ * @param options - Optional auth behavior overrides such as .
  * @returns The access token for the Business Platform API.
  */
-export declare function ensureAuthenticatedBusinessPlatform(scopes?: BusinessPlatformScope[]): Promise<string>;
+export declare function ensureAuthenticatedBusinessPlatform(scopes?: BusinessPlatformScope[], options?: EnsureAuthenticatedAdditionalOptions): Promise<string>;
 /**
  * Logout from Shopify.
  *

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog This PR doesn't include a changeset entry. Is an internal only change not relevant to end users.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants